<template>
	<view class="favorite">
		<View v-if="list.length !=0">
			<template v-for="item in list">
				<view class="box" :key="item.project.projectId" @click="showMsg(item)">
					<view class="box_top">
						<view class="box_top_left  f16">{{item.project.projectName}}</view>
					</view>
					<view class="box_bot">{{item.project.briefly}}</view>
				</view>
			</template>
		</View>
		<View v-else>
			<notFoundData />
		</View>
	</view>
</template>

<script>
	import notFoundData from '@/components/notFoundData/index.vue'
	export default {
		components: {
			notFoundData
		},
		data() {
			return {
				list: []
			}
		},
		methods: {
			showMsg(item) {
				console.log(item, 23);
				// switch (item.project.type) {
				// 	case 0:
				// 		uni.navigateTo({
				// 			url: '/pages/information/itemMsg/itemMsg'
				// 		})
				// 		break;
				// 	case 1:
				// 		uni.navigateTo({
				// 			url: '/pages/information/competionMsg/competionMsg'
				// 		})
				// 		break;

				// }

			}
		},
		async created() {

			try {
				const data = {
					type: null
				}
				const result = await this.$mjcrequest.request({
					url: this.$api.Favoriteitems,
					header: this.$aplsjsonheader,
					data: JSON.stringify(data)
				});
				this.list = result
			} catch (e) {
				this.$errMessageToast(e)
				//TODO handle the exception
			}
		}
	}
</script>

<style lang="less" scoped>
	.favorite {
		padding: 0 15rpx;
		background-color: #fdfdfd;
		padding-bottom: 20rpx;

		.box {
			position: relative;
			margin: 10px 0;

			&_dot {
				position: absolute;
				width: 8px;
				height: 8px;
				border-radius: 50%;
				overflow: hidden;
				background-color: red;
				top: 0;
				right: 0;
			}

			&_top {
				display: flex;
				border-bottom: 1px #DCDCDC solid;
				flex-direction: row;
				align-items: center;
				padding: 10px;
				overflow: hidden;

				&_left {
					display: flex;
					flex: 1;
					flex-direction: row;
					align-items: center;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					overflow: hidden;
				}

				&_right {
					line-height: 12px;
				}
			}

			&_bot {
				padding: 10px;
				font-size: 14px;
				color: #6a6a6a;
				line-height: 22px;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
			}


			padding: 0 10px;
			box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.08);
			border: 1px solid #DCDCDC;
			border-radius: 4px;
			overflow: hidden;
			background-color: #fff;
			font-family: Helvetica Neue,
			Helvetica,
			PingFang SC,
			Hiragino Sans GB,
			Microsoft YaHei,
			SimSun,
			sans-serif;
		}
	}
</style>
